﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Handrise.Mobile.BasicModal.DataLayer ;
using Handrise.Mobile.BasicModal.Config;
using System.Windows.Forms;

namespace Handrise.CDCable.Mobile.Business
{
    public static class AppLogic
    {
        public static DataService dataService ;

        public static ConfigService config;

        public static User LoginUser;

        public static NetService netService;

        public static GPSTraceService gpsTraceService;

        public static Form loginForm;

       // public static ScanService scanService;

        public static void Init() 
        {
            dataService = new DataService() ;
            config = new ConfigService();
            netService = new NetService();
            gpsTraceService = new GPSTraceService();
        }

        //public static void InitScanBar(Form form)
        //{
        //    scanService = new ScanService(form);
        //}

        public static void UnInit()
        {
            gpsTraceService.Close();

           // scanService.Close();
        }

        public static string GetLocalPath()
        {
            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

            if (path.StartsWith("file:\\"))
                return path.Remove(0, 6);
            else
                return path;
        }
    }
}
